﻿ <!--#include file="Conn.asp"-->
<html>
<head>
<title>欢迎光临学习资料查询系统</title>
<link href="css/ponts_common.css" rel="stylesheet" type="text/css"/> 
<link href="css/bj_common.css" rel="stylesheet" type="text/css"/> 
<link href="css/bj_others.css" rel="stylesheet" type="text/css"/> 

<meta http-equiv="Content-Type" content="text/html"; charset="GBK">

</head>
<body onLoad="MM_preloadImages('images/background2.jpg')">
<div class="com_1"><img src="images/42.jpg" alt="1"  border="0" align="middle"/></div>
      <div class="com_2">
       <div class="com_2_1">
   		 <span title="首 页" class="com_2_1_2"><a href="index.asp"  class="headline">首 页</a></span>
    	 <span title="资料查询" class="com_2_1_2"><a href="quest.asp"  class="headline">资料查询</a></span>
   		 <span title="资料共享" class="com_2_1_1"><a href="Uploaduser.asp"  class="headline">资料共享</a></span>
 	     <span title="资料求助" class="com_2_1_1"><a href="seeking.asp" class="headline">资料求助</a></span>
  	     <span title="个人中心" class="com_2_1_1"><a href="memcenter.asp" class="headline">个人中心</a></span>
        </div>
      </div> 
         
      <div class="com_3">    
              <div class="com_3_1">
              <% 
				    dim username
						  username=session("username")
 			if username<>"" then 
			 response.Write("<table><tr valign=top><td>"&"&nbsp;"&"</td></tr>")
			 response.Write("<tr><td  width=74 class=ti align=right>")
			 response.Write("你好!</td><td>"&username&"")
			 response.Write("</td></tr></table>")
	 		else 
            response.Write("<table><tr  valign=top>")
			response.Write("<td><p class=ti>"&"用户登录&amp;注册"&"</p>")
            response.Write("<form action=chklogin.asp method=post name=longform>")   
			response.Write("<table><tr valign=top align=center><td width=74>")
			response.Write("用户名</td>")
			response.Write("<td width=170>")
			response.Write("<input name=passname type=text maxlength=20 size=20>")
			response.Write("</td></tr><tr valign=top align=center><td>")
			response.Write("密码</td>")
     		response.Write("<td><input name=password type=password maxlength=18 size=20></td></tr><tr valign=middle align=center>")
			response.Write("<td colspan=2>   <input name=submit type=submit value=登录 size=2>")
			response.Write(" &nbsp; &nbsp;&nbsp; "&"<a href=Reg.asp class=black>" &"注册 "&"</a>")		
			response.Write("</td></tr></table></form></td></tr></table>")
	 end if
				%>
                </div>
            <div class="com_3_2">
				     <div class="quest_1">
                 		<form action="questget.asp" method="get">
                        <table>
                   <tr valign="middle">
                   	<td width="100" class="ti">搜索:</td>
                        <td width="300" align="left"><input type="text" maxlength="30" name="questname" size="60"></td>
                       <td width="76" align="left"><input type="submit" name="quest" value="查询">  </td>
                   </tr>
                    <tr>
                       <td></td>
                       <td colspan="3">
			<input type="radio" name="lm" value="all" checked="" id="all"/>全部
			<input type="radio" name="lm" value="dz"/>地址
			<input type="radio" name="lm" value="lj"/>连接
   		    <input type="radio" name="lm" value="wj"/>文件
                       </td>
                   </tr>
                   </table>
                   </form>
                        </div> 
                        
                        
                                       
<%
Dim questname,subject,lm,fileid,i,a,pn
i=1
pn=1
pagesize=10
totalsize=0
questname=Trim(Request.QueryString("questname"))
questname= replace (questname,Chr("39"),Chr("39")+Chr("39"))
querywords=split(questname)
lm=Trim(Request.QueryString("lm"))
pn=CInt(Request.QueryString("pn"))		
if questname="" Then
    Response.Write ("<script>alert('请输入名称！')</script>")
    Response.End
   Else
    set Rs=Server.CreateObject("Adodb.Recordset")
    sql="SELECT * FROM resource WHERE filetype='"&lm&"' AND filestate<>2"
    if lm="all" Then
    sql="SELECT * FROM resource WHERE filestate<>2"
    end if
	for i=0 to Ubound(querywords)
        sql=sql&" AND filename LIKE '%"&querywords(i)&"%'"
    next
    Rs.Open sql,Conn,1,1'?必须加1，1
    if Rs.eof and Rs.bof then
	    Response.Write(" <div class=quest_2><div class=view_title>抱歉，没有此资料！</div></div>")
    else
        do until Rs.eof
            totalsize=totalsize+1
            Rs.Movenext
        Loop
        Rs.close
        totalpn=Cint(totalsize)
        pagesize=CInt(pagesize)
        totalpn=totalsize\pagesize
        if totalsize Mod pagesize<>0 then
            totalpn=totalpn+1
        end if
        if pn<1 or pn>totalpn then
            pn=1
        end if
        sql=sql&" LIMIT "&((pn-1)*pagesize)&","&pagesize
        Rs.open sql,Conn,1,1
    i=0 
        Do  until Rs.eof or i=pagesize
                i=i+1
   				Response.Write("<div class=quest_2><div>")
				if Rs("filestate")=1 then 
				Response.Write("<span class=yitongguo>已通过</span>")
				else
				Response.Write("<span class=shenhe>审核中</span>")
				end if 
				Response.Write("<span><a class=view_title1 target=""view_window"" href=view.asp?fileid="&Rs("fileid")&">&nbsp;"&Rs("filename")&"</a></span> ")
				Response.Write(" </div><div class=questget_1>")
				Response.Write("<span class=view_tag>课程代号："&Server.HTMLEncode(Rs("subject"))&"&nbsp;&nbsp;贡献者："&Server.HTMLEncode(Rs("uploaduser"))&"&nbsp;&nbsp;贡献时间："&Server.HTMLEncode(Rs("uploadtime"))&"&nbsp;&nbsp;浏览："&Server.HTMLEncode(Rs("viewtimes"))&"次&nbsp;&nbsp;</span>")
				Response.Write("</div><hr /></div>")
        Rs.Movenext
        Loop        
    end if
    rs.close
End if
conn.close
Set conn=nothing
Response.Write("<div class=questget_2>")
for a=1 to totalpn
    Response.Write("<a class=ti href=questget.asp?pn="&a&"&questname="&questname&"&subject="&subject&"&lm="&lm&" class=black>"&a&"&nbsp;</a>")
next 
Response.Write("</div>")

%>
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        
            </div>
      </div>
      <div class="com_4">
       Copyright@2012 学习资料共享查询系统 v1.0 版权所有 
      </div>
</body>
</html>
